import axios from 'axios'
axios.defaults.withCredentials = true
// const urlNavtive = 'http://localhost:3000'
const urlNavtive = 'https://r.leaguenewway.com'

export interface typeCalss {
  type_id: string
  type_name: string
  type_ids?: number[]
  index?: number
}

export function getClass() {
  return axios({
    url: `${urlNavtive}/newVideoInfo/getClass`
  })
}

export interface navClass {
  type_name: string
  type_id: number
}

export function getClassNav() {
  return axios({
    url: `${urlNavtive}/newVideoInfo/getClassNav`
  })
}

export interface getListParams {
  name?: string
  classname?: string
  actor?: string
  type_id?: string
}

export function getList(count: number, page: number, params: getListParams) {
  return axios({
    url: `${urlNavtive}/newVideoInfo/getList`,
    params: {
      count,
      page,
      ...params
    }
  })
}

export function getSwiper(type_id: string) {
  return axios({
    url: `${urlNavtive}/newVideoInfo/getSwiper`,
    params: {
      type_id
    }
  })
}


export function configGet(key: string) {
  return axios({
    method: 'get',
    url: `${urlNavtive}/newVideoInfo/configGet`,
    params: {
      key
    },
    responseType: 'json'
  })
}